<template>
    <h1 ref="myh1">我是首页的内容</h1>

    <button @click="getH1">获取标签</button>
</template>

<script setup>
import { ref } from 'vue'

const myh1 = ref(null)

function getH1() {
    console.log('获取 h1 标签: ', myh1.value);
}

</script>